﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;

namespace KPIS.GERP.Models.SYS
{
    [DataContract, Table("SysApproveProcess")]
    public class ApproveProcess
    { 
        [Key, DataMember, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int AppPrcId { get; set; }

        [DataMember]
        public string Name { get; set; }

        [DataMember]
        public string Description { get; set; }

        // ถ้าไปหาใน Mapping แล้วไม่เจอ จะวิ่งมาที่ตัวที่เป็น Default
        [DataMember]
        public bool IsDefaultProcess { get; set; } 

        [DataMember]
        [ForeignKey("ApproveProcessGroup")]
        public int AppPrcGrpId { get; set; }

        [DataMember]
        public ICollection<ApprovePath> ApprovePaths { get; set; }

        [DataMember]
        public ApproveProcessGroup ApproveProcessGroup { get; set; }

        #region

        [DataMember]
        public string RecordStatus { get; set; }

        [DataMember]
        public int? CreatedBy { get; set; }

        [DataMember]
        public DateTime? CreatedWhen { get; set; }

        [DataMember]
        public int? UpdatedBy { get; set; }

        [DataMember]
        public DateTime? UpdatedWhen { get; set; }

        #endregion

    }

    public enum ApprovePathState
    {
        Error,
        Current,
        Pass,
        After
    }
}